package com.zhiyou.crowdfunding.service.impl;

import com.zhiyou.crowdfunding.dao.UserMapper;
import com.zhiyou.crowdfunding.pojo.User;
import com.zhiyou.crowdfunding.service.UserService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;


    @Override
    public int add(User user) {
        return userMapper.insert(user);
    }

    @Override
    public int del(Long id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int update(User user) {
        return userMapper.updateByPrimaryKey(user);
    }

    @Override
    public List<User> selectByCondition(User user) {
        return userMapper.select(user);
    }

    @Override
    public int insertList(List<User> users) {
        return userMapper.insertList(users);
    }

    @Override
    public int delIds(Long[] ids) {
        String idsStr="2,3,5 ";
        return userMapper.deleteByIds(idsStr);
    }

    @Override
    public User selectByName(String name) {
        return userMapper.selectByName(name);
    }
}
